/*
 * communication.h
 *
 *  Created on: 05.12.2013
 *      Author: Franz Steinmetz
 */

#ifndef COMMUNICATION_H_
#define COMMUNICATION_H_

#include "../message.h"

const uint64_t DEFAULT_PIPE = 0xF0F0F0F0E1LL;
const uint8_t ANY_SLAVE = 10;


void com_init_master();
void com_init_slave();

message com_read_msg_from_master(uint32_t timeout_millis = 250);
message com_read_msg_from_slave(uint8_t pipe = ANY_SLAVE, uint32_t timeout_millis = 250);

bool com_send_msg_to_master(message msg);
bool com_send_msg_to_slave(message msg, uint8_t slave);

bool com_available();

bool com_pair_with_slave();
bool com_pair_with_master();

uint8_t com_num_slaves();

void com_activate_debug();
void com_deactivate_debug();


#endif /* COMMUNICATION_H_ */
